"use strict";
require('app-module-path').addPath(__dirname);

const	debug = require('debug')('debug');
const	config = require('src/common/get-config');
const	bodyParser = require('body-parser');
const	expressValidator = require('express-validator');
const	mongoose = require('mongoose');
const	express = require('express');

const	app = express(); 
app.use(bodyParser.json());
app.use(expressValidator());

require('src/routes')(app);
app.use(function(req,res,next){
  res.status(404);
  res.json('404');
});

app.use(function(err,req,res,next){
  res.json('505');
});

app.listen(config.port, function(){
  console.log(`Express started on http://localhost + ${config.port} ;press Ctrl-C to terminate`);
});
module.exports = app;


//NODE_ENV=test node index.js
